package com.pingan.pastry.web;

import com.pingan.pastry.common.util.UserUtil;
import com.pingan.pastry.dao.MenuDAO;
import com.pingan.pastry.entity.MenuDto;
import com.pingan.pastry.service.MenuService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("/menu")
public class MenuController {

    @Resource
    private MenuService menuService;


    @RequestMapping("/queryById")
    @ResponseBody
    public List<MenuDto> queryMenus(){
        Integer id = UserUtil.getCurrentUser().getId();
        List<MenuDto> menus = menuService.listMenu(id);
        return menus;
    }


}
